<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="layout" content="main"/>
    <title>ProductCategory List</title>
    <g:javascript library="jquery"/>
    <jq:plugin name="treeview"/>
    <link rel="stylesheet" href="${createLinkTo(dir: 'css', file: 'jquery.treeview.css')}"/>
</head>
<body>
<div class="nav">
    <span class="menuButton"><a class="home" href="${createLinkTo(dir: '')}">Home</a></span>
    <span class="menuButton"><g:link class="create" action="create">New ProductCategory</g:link></span>
</div>
<div class="body">
    <h1>ProductCategory List</h1>
    <g:if test="${flash.message}">
        <div class="message">${flash.message}</div>
    </g:if>
    <div class="list">
        <table>
            <thead>
            <tr>

                <g:sortableColumn property="id" title="Id"/>

                <g:sortableColumn property="name" title="Name"/>

                <g:sortableColumn property="parent" title="Parent" defaultOrder="asc"/>

            </tr>
            </thead>
            <tbody>
            <g:each in="${productCategoryInstanceList}" status="i" var="productCategoryInstance">
                <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">

                    <td><g:link action="show" id="${productCategoryInstance.id}">${fieldValue(bean: productCategoryInstance, field: 'id')}</g:link></td>

                    <td>${fieldValue(bean: productCategoryInstance, field: 'name')}</td>

                    <td>${fieldValue(bean: productCategoryInstance, field: 'parent')}</td>

                </tr>
            </g:each>
            </tbody>
        </table>
    </div>
    <div class="paginateButtons">
        <g:paginate total="${ProductCategory.count()}"/>
    </div>

    <script type="text/javascript">
        $(document).ready(function() {
            $("ul[id^='productTree']").treeview();
        });
    </script>

    <div id="treeview">
        <g:each in="${roots}" var="root" status="i">
            <ps:treeview root="${root}"
                    childrenListName="sortedChildren"
                    id="productTree${i}"
                    class="filetree treeview-famfamfam"
                    folderController="productCategory"
                    fileController="product"
                    folderAction="show"
                    fileAction="show"/>
        </g:each>
    </div>

</div>
</body>
</html>
